package com.example.finance_oa.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.example.comment_oa.pojos.Invoice;
import com.example.comment_oa.pojos_vo.InvoiceVO;
import com.example.finance_oa.mapper.IdentifyMapper;
import com.example.finance_oa.service.InvoiceService;
import com.example.finance_oa.mapper.InvoiceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author Jin
 * @description 针对表【invoice】的数据库操作Service实现
 * @createDate 2022-10-17 10:46:55
 */
@Service
public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice>
        implements InvoiceService{
    @Autowired
    InvoiceMapper invoiceMapper;
    @Autowired
    IdentifyMapper identifyMapper;
    @Override
    //查询所登录员工自己的所有发票
    public List<Invoice> allByempId(InvoiceVO invoice) {
//        List<Invoice> list=invoiceMapper.allbyemdId(invoice);
        return invoiceMapper.allbyemId(invoice);
    }
    //查询未辨伪的所有发票
    @Override
    public List<Invoice> allBywbw() {
        return invoiceMapper.findAllByInvoiceAuthenticity();
    }
    //发票辨伪
    @Override
    public int invoiceBybw(InvoiceVO invoiceVO) {
        invoiceMapper.invoiceBybw(invoiceVO);
        identifyMapper.insertall(invoiceVO);
        return 0;
    }
    //删除发票
    @Override
    public int deleteInvoice(String invoicePhone) {
        return invoiceMapper.deleteByInvoicePhone(invoicePhone);
    }
    //新增发票
    @Override
    public int insertInvoice(Invoice invoice) {
        int a=invoiceMapper.insert(invoice);
        return a;
    }

    //根据发票号码查重
    @Override
    public List<Invoice> InvoicePhone(String invoicePhone) {
        return invoiceMapper.invoicePhone(invoicePhone);
    }

    @Override
    public List<Invoice> selectallwbx(int empId) {
        return invoiceMapper.selectAllwbx(empId);
    }


}




